package team.zero.lemon.pattern.Singleton;

/**
 * Created by bolin on 2016/12/6.
 */
//public class Singleton {
//    private static Singleton ourInstance = new Singleton();
//
//    public static Singleton getInstance() {
//        return ourInstance;
//    }
//
//    private Singleton() {
//    }
//}
public class Singleton {
    private volatile static Singleton singleton;
    private Singleton() {
    }
    public static Singleton getSingleton() {
        if (singleton == null) {
            synchronized (Singleton.class) {
                if (singleton == null) {
                    singleton = new Singleton();
                }
            }

    }return singleton;
    }
}